<!-- 订单列表 -->
<section class="orders">
<div class="order-btn-row">
    <div class="btn-group cart-btn">
        <button class="btn order-btn"
            ng-class="{'active': orderType == 'COMMODITIES'}"
            ng-click="setType('COMMODITIES')">商城订单</button>
        <button class="btn order-btn"
            ng-class="{'active': orderType == 'TRANSFER'}"
            ng-click="setType('TRANSFER')">转运订单</button>
    </div>
</div>
<div class="order-detail" ng-repeat="order in orders">
    <table ng-if="orderType=='COMMODITIES'" class="table ngCart cart-table">
        <thead>
        <tr>
            <td class="check-cell" colspan="2">
                <span> 订单号: {{order.short_id}}
                </span>
                <span class="logistic-btn status">状态:  {{order.current_status}}</span>
            </td>
            <td class="detail-cell">
                <a href="#/order/{{order.id}}">详情 ></a>
            </td>
        </tr>
        </thead>

        <tbody>
        <tr ng-repeat="entry in order.entries track by $index">

            <td class="img-cell">
                <div>
                    <a ng-href="#/items/{{entry.item.item_id}}">
                        <img ng-src="{{entry.spec.images[0]}}">
                    </a>
                </div>
            </td>
            <td class="info-cell">
                <div>{{ entry.item.title }}</div>
                <div>
                    <span ng-repeat="(k, v) in entry.spec.attributes">
                        {{ngCart.attrMap[k]}}: {{v}}
                    </span>
                </div>
                <div class="btn-group cart-btn">
                    <span>数量: {{ entry.quantity | number }}</span>
                </div>
            </td>
            <td class="price-cell">{{ entry.amount_usd | currency }}</td>
        </tr>
        </tbody>

        <tfoot>
        <tr>
            <td class="status-cell" ng-if="order.payment_status=='PAID'">已付款</td>
            <td class="status-cell" ng-if="order.payment_status=='UNPAID'">
                <ngcart-checkout settings="{ order_id: order.id , order_type: 'existed'}">去付款</ngcart-checkout>
            </td>
            <td colspan="2" class="fee-cell">运费:
                <span class="price-cell">{{ order.cn_shipping | currency }}</span>
                总计:
                <span class="price-cell">{{ order.final | currency }}</span>
            </td>
        </tr>
        <tr ng-show="order.payment_status == 'PAID'">
            <td class=""></td>
            <td class="" colspan="2">
                <a class="logistic-btn pull-right"
                    href="/#/order/logistics/{{order.id}}">
                    查看物流
                </a>
            </td>
        </tr>
        </tfoot>
    </table>

    <table ng-if="orderType=='TRANSFER'" class="table ngCart cart-table express">
        <thead>
        <tr>
            <td class="check-cell" colspan="5">
                <span> 订单号: {{order.short_id}}
                </span>
                <span class="logistic-btn status">状态:  {{order.current_status}}</span>
                <span class="pull-right">
                    <a class="logistic-btn"
                        ng-href="/#/order/transfer/{{order.id}}">
                        查看物流
                    </a>
                </span>
            </td>
        </tr>
        <tr>
            <td class="title1">
                <span>商品名称:</span>
            </td>
            <td class="cate">
                <span>类型:</span>
            </td>
            <td class="quantity1">
                <span>数量:</span>
            </td>
            <td class="value">
                <span>申报价值:</span>
            </td>
            <td class="note">
                <span>备注:</span>
            </td>
        </tr>
        </thead>

        <tbody>
        <tr ng-repeat="entry in order.entries track by $index">
            <td class="title1">
                {{ entry.title }}
            </td>
            <td class="cate">
                {{ entry.main_category }}
            </td>
            <td class="quantity1">
                {{ entry.quantity }}
            </td>
            <td class="value">
                ￥{{ entry.amount }}
            </td>
            <td class="note">
                {{ entry.remark }}
            </td>
        </tr>
        </tbody>

        <tfoot>
        <tr>
            <td class="status-cell" ng-if="order.payment_status=='PAID'">已付款</td>
            <td class="status-cell" ng-if="order.payment_status=='UNPAID' && order.status =='WAREHOUSE_IN'">
                <a class="btn checkout-btn" ng-href="/#/order/transfer/{{order.id}}">去付款</a>
            </td>
            <td colspan="4" class="fee-cell">运费:
                <span class="price-cell">{{ order.cn_shipping | currency }}</span>
                总计:
                <span class="price-cell">{{ order.final | currency }}</span>
            </td>
        </tr>
        </tfoot>
    </table>

</div>
</section>
